# A valid snippet should starts with:
#
#		snippet trigger_word [ "description" [ options ] ]
#
# and end with:
#
#		endsnippet
#
# Snippet options:
#
#		b - Beginning of line.
#		i - In-word expansion.
#		w - Word boundary.
#		r - Regular expression
#		e - Custom context snippet
#		A - Snippet will be triggered automatically, when condition matches.
#
# Basic example:
#
#		snippet emitter "emitter properties" b
#		private readonly ${1} = new Emitter<$2>()
#		public readonly ${1/^_(.*)/$1/}: Event<$2> = this.$1.event
#		endsnippet
#
# Online reference: https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt
snippet main "Dart main method" b
void main() {
	$0
}
endsnippet

snippet ident "Anonymous identity method" w
(${1:_}) => $1
endsnippet

snippet class "Class outline" b
class $1 {
	$0
}
endsnippet

snippet im "Import" b
import 'package:$1/${2:$1}.dart';
endsnippet

snippet for "For-in loop" b
for(var $1 in ${2:$1s}) {
	$0
}
endsnippet

snippet fori "indexed for loop" b
for(int i = 0, ${3:l} = $2.length; i<$3; i++) {
	var $1 = ${2:$1s}[i];
	$0
}
endsnippet

snippet try "Try/catch block" b
try {
	${1:${VISUAL}}
} catch(${2:e}${3:, st}) {
	$4
}
endsnippet

snippet if "If block" b
if ($1) {
	${2:${VISUAL}}
}
endsnippet

snippet m "Anonymous method" w
($1) {
	$0
}
endsnippet

snippet r "Anonymous single statement return" w
($1) => $0
endsnippet

snippet am "Async anonymous method" w
($1) async {
	$0
}
endsnippet

snippet ar "Async anonymous single statement method" w
($1) async => $0
endsnippet

priority 1
snippet m "Instance or top level method" b
${1:void} $2($3) {
	$0
}
endsnippet

snippet r "Single statement return" b
$1 $2($3) => $0;
endsnippet

snippet am "Async instance or top level method" b
Future<${1:void}> $2($3) async {
	$0
}
endsnippet

snippet ar "Async single statement return" b
Future<$1> $2($3) async => $0;
endsnippet

snippet stless "statelewss widget" b
class $1 extends StatelessWidget {
	@override
	Widget build(BuildContext context) {
		return $2
	}
}
endsnippet

snippet stful "stateful widget" b
class $1 extends StatefulWidget {
	@override
	_$1State createState() => _$1State();
}

class _$1State extends State<$1> {
	@override
	Widget build(BuildContext context) {
		return $2
	}
}
endsnippet

snippet ts "test skeleton" b
import 'package:flutter_test/flutter_test.dart';

void main() {
	$0
}
endsnippet

snippet t "test block" b
test('$1', () {
	$0
});
endsnippet

snippet tw "test widgets block" b
testWidgets('$1', (tester) async {
	$0
});
endsnippet

snippet g "test group" b
group('$1', () {
	$0
});
endsnippet

snippet e "expect" b
expect($1, $2);
endsnippet

snippet eow "expect one widget" b
expect($0, findsOneWidget);
endsnippet

snippet en "expect nothing" b
expect($0, findsNothing);
endsnippet

snippet fwt "find by text" w
find.widgetWithText($1, '$2')
endsnippet

snippet ft "find text" w
find.text('$1')
endsnippet

snippet ftp "find by type" w
find.byType($1)
endsnippet
